{template 'store/diypage/_common'}

<form action="" method="get">

    <input type="hidden" name="c" value="site">
    <input type="hidden" name="a" value="entry">
    <input type="hidden" name="m" value="mx_shop">
    <input type="hidden" name="do" value="web">
    <input type="hidden" name="r" value="store.diypage.page">
    <input type="hidden" name="id" value="{$storeid}">
    <div class="page-toolbar">
        <div class="col-sm-6">
            {if $_GPC['r']=='store.diypage.page'}
                {ifp 'store.diypage.page.add'}
                    <span class=''>
                        <a class='btn btn-primary btn-sm' href="{php echo webUrl('store/diypage/create', array('storeid'=>$storeid))}" data-toggle="ajaxModal"><i class="fa fa-plus"></i> 新建页面</a>
                    </span>
                {/if}
            {/if}
        </div>
        <div class="col-sm-6 pull-right">
            <div class="input-group">
                <div class="input-group-select">
                    <select name="status" class="form-control  input-sm" style="width:120px;">
                        <option value="" {if $_GPC['status']==''} selected{/if}>页面状态</option>
                        <option value="0" {if $_GPC['status']=='0'} selected{/if}>禁用</option>
                        <option value="1" {if $_GPC['status']=='1'} selected{/if}>启用</option>
                    </select>
                </div>
                <input type="text" class="input-sm form-control" name="keyword" value="{$_GPC['keyword']}" placeholder="输入页面名称进行搜索">
                <span class="input-group-btn">
                    <button class="btn btn-primary" type="submit"> 搜索</button>
                </span>
            </div>
        </div>
    </div>
</form>

{if empty($list)}
    <div class="panel panel-default">
        <div class="panel-body" style="text-align: center;padding:30px;">未查询到相关页面</div>
    </div>
{else}
    <div class="page-table-header">
        <input type="checkbox">
        <div class="btn-group">
            {ifp 'store.diypage.page.edit'}
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch" data-confirm="确认要启用?" data-href="{php echo webUrl('store/diypage/page/status', array('status'=>1))}" disabled="disabled">
                <i class="icow icow-qiyong"></i> 启用
            </button>
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch" data-confirm="确认要禁用?" data-href="{php echo webUrl('store/diypage/page/status', array('status'=>0))}" disabled="disabled">
                <i class="icow icow-jinyong"></i> 禁用
            </button>
            {/if}
            {ifp 'store.diypage.page.delete'}
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch-remove" data-confirm="确认要删除?" data-href="{php echo webUrl('store/diypage/page/delete')}">
                <i class="icow icow-shanchu1"></i> 删除
            </button>
            {/if}
        </div>
    </div>
    <table class="table table-hover table-responsive">
        <thead>
            <th style="width: 30px;">
                <input type="checkbox" />
            </th>
            <th style="width: 50px;">ID</th>
            <th>页面名称</th>
            <th style="width: 160px;">创建时间</th>
            <th style="width: 90px">状态</th>
            <th style="width: 115px;">操作</th>
        </thead>
        <tbody>
        {loop $list $item}
            <tr>
                <td>
                    <input type="checkbox" value="{$item['id']}" />
                </td>
                <td>{$item['id']}</td>
                <td>{$item['name']}</td>
                <td>{php echo empty($item['createtime'])? '-': date('Y-m-d H:i:d', $item['createtime'])}</td>
                <td>
                    <span class="label {if $item['status']==1}label-primary{else}label-default{/if}"
                          {ifp 'store.diypage.page.edit'}
                          data-toggle='ajaxSwitch'
                          data-switch-value="{$item['status']}"
                          data-switch-value0="0|禁用|label label-default|{php echo webUrl('store/diypage/page/status',array('status'=>1,'id'=>$item['id']))}"
                          data-switch-value1="'1|启用|label label-success|{php echo webUrl('store/diypage/page/status',array('status'=>0,'id'=>$item['id']))}"
                          style="cursor: pointer;"
                            {/if}
                    >{if $item['status']==1}启用{else}禁用{/if}</span>
                </td>
                <td>
                    {ifp 'store.diypage.preview'}
                        <a class="btn btn-default btn-sm btn-operation btn-op" href="{php echo webUrl('store/diypage/preview', array('id'=>$item['id'], 'ispage'=>1, 'storeid'=>$storeid))}" target="_blank">
                            <span data-toggle="tooltip" data-placement="top" title="" data-original-title="预览">
                                <i class='icow icow-chakan-copy'></i>
                           </span>
                        </a>
                    {/if}
                    {ifp 'store.diypage.page.edit'}
                        <a class="btn btn-default btn-sm btn-operation btn-op" href="{php echo webUrl('store/diypage/page/edit', array('id'=>$item['id'], 'storeid'=>$storeid))}">
                            <span data-toggle="tooltip" data-placement="top" title="" data-original-title="编辑">
                                <i class='icow icow-bianji2'></i>
                           </span>
                        </a>
                    {/if}
                    {ifp 'store.diypage.page.delete'}
                        <a class="btn btn-default btn-sm btn-operation btn-op" data-toggle="ajaxRemove" href="{php echo webUrl('store/diypage/page/delete', array('id'=>$item['id']))}" data-confirm="确定删除此页面吗？此操作不可恢复">
                           <span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除">
                                 <i class='icow icow-shanchu1'></i>
                            </span>
                        </a>
                    {/if}
                </td>
            </tr>
        {/loop}
        </tbody>
        <tfoot>
            <tr>
                <td><input type="checkbox"></td>
                <td colspan="2">
                    <div class="btn-group">
                        {ifp 'store.diypage.page.edit'}
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch" data-confirm="确认要启用?" data-href="{php echo webUrl('store/diypage/page/status', array('status'=>1))}" disabled="disabled">
                            <i class="icow icow-qiyong"></i> 启用
                        </button>
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch" data-confirm="确认要禁用?" data-href="{php echo webUrl('store/diypage/page/status', array('status'=>0))}" disabled="disabled">
                            <i class="icow icow-jinyong"></i> 禁用
                        </button>
                        {/if}
                        {ifp 'store.diypage.page.delete'}
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch-remove" data-confirm="确认要删除?" data-href="{php echo webUrl('store/diypage/page/delete')}">
                            <i class="icow icow-shanchu1"></i> 删除
                        </button>
                        {/if}
                    </div>
                </td>
                <td colspan="3" class="text-right">{$pager}</td>
            </tr>
        </tfoot>
    </table>
{/if}

{template '_footer'}